Skip to content

Conversation

@doringeman
Copy link
Contributor

When using the OpenAI SDK (https://github.com/openai/openai-node/blob/master/src/lib/ChatCompletionStream.ts#L623-L626) we noticed that the expected assistant role is missing in the first streaming message. Fix this by correctly checking for the first message.

When using the OpenAI SDK (https://github.com/openai/openai-node/blob/master/src/lib/ChatCompletionStream.ts#L623-L626) we noticed that the expected assistant role is missing in the first streaming message. Fix this by correctly checking for the first message.

Co-authored-by: Piotr Stankiewicz <[email protected]>
Signed-off-by: Dorin Geman <[email protected]>
ngxson
ngxson previously approved these changes May 19, 2025
Copy link
Collaborator

@ngxson ngxson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional, but would be appreciate if you can modify one of the test case to test for this

@ngxson ngxson dismissed their stale review May 19, 2025 13:57

This breaks a test case, please fix it first

Co-authored-by: Piotr Stankiewicz <[email protected]>
Signed-off-by: Dorin Geman <[email protected]>
@doringeman
Copy link
Contributor Author

Thanks @ngxson! We fixed and added comments for the first role message that comes with stream=True.

@github-actions github-actions bot added the python python script changes label May 19, 2025
@ngxson ngxson merged commit 42158ae into ggml-org:master May 21, 2025
48 checks passed
infil00p pushed a commit to baseweight/llama.cpp that referenced this pull request May 22, 2025
* server : fix first message identification

When using the OpenAI SDK (https://github.com/openai/openai-node/blob/master/src/lib/ChatCompletionStream.ts#L623-L626) we noticed that the expected assistant role is missing in the first streaming message. Fix this by correctly checking for the first message.

Co-authored-by: Piotr Stankiewicz <[email protected]>
Signed-off-by: Dorin Geman <[email protected]>

* server : Fix checks for first role message for stream=True

Co-authored-by: Piotr Stankiewicz <[email protected]>
Signed-off-by: Dorin Geman <[email protected]>

---------

Signed-off-by: Dorin Geman <[email protected]>
Co-authored-by: Piotr Stankiewicz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples python python script changes server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants